package com.ruoyi.backend.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.backend.mapper.OrderStageMapper;
import com.ruoyi.backend.domain.OrderStage;
import com.ruoyi.backend.service.IOrderStageService;

/**
 * 订单款项Service业务层处理
 * 
 * @author wjr
 * @date 2025-09-23
 */
@Service
public class OrderStageServiceImpl implements IOrderStageService 
{
    @Autowired
    private OrderStageMapper orderStageMapper;

    /**
     * 查询订单款项
     * 
     * @param id 订单款项主键
     * @return 订单款项
     */
    @Override
    public OrderStage selectOrderStageById(Integer id)
    {
        return orderStageMapper.selectOrderStageById(id);
    }

    /**
     * 查询订单款项列表
     * 
     * @param orderStage 订单款项
     * @return 订单款项
     */
    @Override
    public List<OrderStage> selectOrderStageList(OrderStage orderStage)
    {
        return orderStageMapper.selectOrderStageList(orderStage);
    }

    /**
     * 新增订单款项
     * 
     * @param orderStage 订单款项
     * @return 结果
     */
    @Override
    public int insertOrderStage(OrderStage orderStage)
    {
        orderStage.setCreateBy(SecurityUtils.getUsername());
        orderStage.setCreateTime(DateUtils.getNowDate());
        return orderStageMapper.insertOrderStage(orderStage);
    }

    /**
     * 修改订单款项
     * 
     * @param orderStage 订单款项
     * @return 结果
     */
    @Override
    public int updateOrderStage(OrderStage orderStage)
    {
        orderStage.setUpdateBy(SecurityUtils.getUsername());
        orderStage.setUpdateTime(DateUtils.getNowDate());
        return orderStageMapper.updateOrderStage(orderStage);
    }

    /**
     * 批量删除订单款项
     * 
     * @param ids 需要删除的订单款项主键
     * @return 结果
     */
    @Override
    public int deleteOrderStageByIds(Integer[] ids)
    {
        return orderStageMapper.deleteOrderStageByIds(ids);
    }

    /**
     * 删除订单款项信息
     * 
     * @param id 订单款项主键
     * @return 结果
     */
    @Override
    public int deleteOrderStageById(Integer id)
    {
        return orderStageMapper.deleteOrderStageById(id);
    }
}
